import request from "@/utils/request"

export const getList = (dsp: any) => {
  return request("/pubdatasourceconfig/list", "GET", dsp)
}

export const deleteOne = (id: number) => {
  return request("/pubdatasourceconfig/delete/" + id, "GET", {})
}

export const loadDataSource = (id: number) => {
  return request("/pubdatasourceconfig/loadDataSource/" + id, "GET", {})
}

export const unloadDataSource = (id: number) => {
  return request("/pubdatasourceconfig/unloadDataSource/" + id, "GET", {})
}

export const submitData = (dsp: any) => {
  if (dsp.id) {
    return request("/pubdatasourceconfig/edit", "POST", dsp)
  }
  return request("/pubdatasourceconfig/add", "POST", dsp)
}

export const getOne = (id: number) => {
  return request("/pubdatasourceconfig/detail", "GET", { id: id })
}

export const getFields = (id: number,tableName:string) => {
  return request("/pubdatasourceconfig/getFields" , "GET", { id: id,tableName:tableName })
}
